{*
SPDX-FileCopyrightText: © 2023 Olivier Meunier <olivier@neokraft.net>

SPDX-License-Identifier: AGPL-3.0-only
*}
{{ extends "/base" }}

{{ block body() -}}
  {{- yield quickAccessMenu(items=slice(
    slice("menu", "Menu"),
    slice("sidemenu", "Secondary Menu"),
    slice("content", "Main content"),
  )) -}}
  <div class="layout" data-controller="panel"
    data-panel-hidden-class="sidemenu--hidden"
    data-panel-body-class="max-sm:overflow-hidden"
  >
    {{ include "/menu" }}

    <button
      data-action="click->panel#toggleMenu"
      data-panel-target="button"
      aria-expanded="false"
      aria-controls="sidemenu"
      class="hidden max-sm:flex
        fixed z-40 w-12 h-12 bottom-2 left-2
        items-center justify-center py-2
        select-none rounded-2xl ring-1 ring-offset-1 ring-white cursor-pointer
        bg-gray-800 text-white
        dark:bg-gray-100
        "
    >
      {{- yield icon(name="o-menu", class="inline-block", svgClass="w-6 h-6") -}}
      <span class="sr-only">Open menu</span>
    </button>

    <nav
      id="sidemenu"
      tabindex="-1"
      data-panel-target="panel"
      aria-labelledby="sidemenu-title"
      data-action="keydown.esc->panel#toggleMenu"
      class="sidemenu sidemenu--hidden"
    >
      {{ try }}{{- yield sideMenu() -}}{{ end }}
    </nav>

    <main class="layout-content" id="content">
      {{ yield flashes() }}
      {{ yield mainContent() }}
    </main>
  </div>
{{- end}}
